#include "Madlglogon.h"
#include "dbdata.h"
extern CDBdata *pgdb;
extern MUser * puser1;
Madlglogon::Madlglogon(QDialog *parent)
    : QDialog(parent)
{
    // this->setModal(true);
	ui.setupUi(this);
    // ui.setModal(true);
        ui.lineEdit->setText(pgdb->getLastUser());
}
void Madlglogon::accept()
{
    if (pgdb->loadUser(ui.lineEdit->text()))
    {
        if(puser1->password==ui.lineEdit_2->text())
        {
            QDialog::accept();
        }
        else
        {
            qDebug()<<"password is error!";
        }
    }
    else
    {
        //QMessageBox(QMessageBox::Warning,"","no this user!");
        //can not show because dlglogon is modal
        qDebug()<<"no this user!";
    }
}
void Madlglogon::reject()
{
	qDebug("reject");
	QDialog::reject();
}

Madlglogon::~Madlglogon()
{

}
